clear all;
close all

R=120;
C=33e-12;
tau=R*C;
Rd=0;
rd=0;
Uo=0;

T=tau/100;


t=0:T:(15*tau);
It=length(t);
omega=50e+9;

Uc=nan(1, It);
dUc=nan(1, It);
Ud=nan(1, It);
i=nan(1, It);
di=nan(1, It);


u=zeros(size(t));


for k=2:It;
    E(k)=sin(2*pi*omega*T*k);
    if E(k)>=0
        u(k)=u(k-1)+T*E(k)/tau-T*u(k-1)/tau;
    else 
        u(k)=u(k-1);
    
    end;
end

u(k)
plot(t,u);
% figure
% plot(t,E);
% 
% X=randn(1,N)+1i*randn(1,N);
% Y=X*u(k);
% figure(2);
% plot(t,Y);